/*
 * TITLE:ResponseBoardAnswer
 * AUTHOR:Manori Thakur
 * PURPOSE: Processes the response to indicate player whether the answer is correct
 */
package clientresponse;

import android.util.Log;
import java.io.IOException;

/**
 * Process a response from the server containing a list of local players.
 * 
 * @author brian
 */
public class ResponseLocalPlayers extends ResponseFromServer {
	private static final String TAG = ResponseLocalPlayers.class
			.getSimpleName();

	/*
	 * Comment out for testing public static Vector<PlayerLocation>
	 * local_players; // Static variable for accessing local_players list.
	 */

	@Override
	public short process() {
		try {
			Log.d(TAG, "Client: parsing server response ...");
			// Protocol for data returned from server:
			// numResults [, character_name1, sprite1, pos_x1, pos_y1
			// [,character_name2, ... [,etc]]]
			/*
			 * Comment out for testing
			 */
			int numResults;
			String name;
			String sprite;
			int pos_x, pos_y;

			numResults = super.readInt(inFromServer);
			name = super.readString(inFromServer);
			sprite = super.readString(inFromServer);
			pos_x = super.readInt(inFromServer);
			pos_y = super.readInt(inFromServer);

			Log.d(TAG, name + " looks like a " + sprite
					+ " and is nearby at position " + "(" + pos_x + "," + pos_y
					+ ")");

			if (false)
				throw new IOException();

		} catch (IOException ex) {
			Log.e(TAG, "IO Exception in method process()" + ex.toString());
		}
		return -2;
	}

}